package test_package;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

import java.util.concurrent.TimeUnit;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 27.11.13
 * Time: 12:00
 * To change this template use File | Settings | File Templates.
 */
public class buxfer_com_HomePage {
    @FindBy(id="login_username")
    private WebElement login_input_field;
    @FindBy(id="login_password")
    private WebElement password_input_field;
    @FindBy(xpath="//a[contains(text(),'Login')]")
    private WebElement login_btn;

    private WebDriver driver;

    public buxfer_com_HomePage (WebDriver driver){
        this.driver=driver;
        PageFactory.initElements(driver, this);
    }

    public buxfer_com_AccountMainPage login(String login, String password) {
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        login_input_field.sendKeys(login);
        password_input_field.sendKeys(password);
        new Actions(driver).moveToElement(login_btn).click().perform();
        //login_btn.click();
        return new buxfer_com_AccountMainPage(driver);
    }
}
